package leetcode.trietree;

import leetcode.string.common.StringUtils;
import leetcode.trietree.common.TrieTreeUtils;

class Solution2185 {
    /**
     * 1 <= words.length <= 100
     * 1 <= words[i].length, pref.length <= 100
     * words[i] 和 pref 由小写英文字母组成
     *
     * @param words
     * @param pref
     * @return
     */
    public int prefixCount(String[] words, String pref) {
        // 本题采用字典树的方式解决耗时比较久
//        return TrieTreeUtils.prefixCount(words, pref);
        return StringUtils.prefixCount(words, pref);
    }
}

public class leetcode2185 {
    public static void main(String[] args) {
        Solution2185 solution2185 = new Solution2185();
        String[] words = {"pay","attention","practice","attend"};
        System.out.println(solution2185.prefixCount(words, "at"));
    }
}
